.. This file was automatically converted from MediaWiki syntax. If some markup is wrong, looks weird or doesn't make sense, feel free to fix it. Please remove this comment once this file was manually checked and no "strange ReST" artifacts remain. .. _bullet-ghosts: Bullet Ghosts ============= Ghost objects are intangible objects. They do collide with other objects, but they won't create any collision response (forces etc.) from such collisions. Ghost objects keep track of all objects they collide with, and it is possible to query them for all objects they currently overlap with. Ghost objects therefore can be used to implement a sensor, which detects the presence of any (or a particular) object within the sensor's shape. For example an automatic door which should open if the player is in front of the door, or an area which triggers some event if the player moves through the area. Example for how to setup a ghost object: .. only:: python .. code-block:: python from panda3d.bullet import BulletGhostNode from panda3d.bullet import BulletBoxShape shape = BulletBoxShape(Vec3(1, 1, 1)) ghost = BulletGhostNode('Ghost') ghost.addShape(shape) ghostNP = render.attachNewNode(ghost) ghostNP.setPos(0, 0, 0) ghostNP.setCollideMask(BitMask32(0x0f)) world.attachGhost(ghost) .. only:: cxx .. code-block:: cpp TODO Example for how to get overlapping objects: .. only:: python .. code-block:: python def checkGhost(self, task): ghost = ghostNP.node() print ghost.getNumOverlappingNodes() for node in ghost.getOverlappingNodes(): print node return task.cont taskMgr.add(checkGhost, 'checkGhost') .. only:: cxx .. code-block:: cpp TODO